package com.icedevcloud.upms.api.dict;

import com.icedevcloud.common.core.api.R;
import com.icedevcloud.upms.api.dict.dto.DictSimpleResDto;
import com.icedevcloud.upms.service.ISysDictService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 字典远程调用 SysSysDictRemote
 *
 * @author dengbing
 * @since 2023-09-13
 */
@AllArgsConstructor
@RequestMapping("/provider/sysDict")
@RestController
public class SysSysDictProvider implements ISysDictProvider {

    private final ISysDictService iSysDictService;

    @Override
    public R<List<DictSimpleResDto>> getDictByDictType(String dictType) {
        List<DictSimpleResDto> resDtos = iSysDictService.getDictByDictType(dictType);
        return R.ok(resDtos);
    }

    @Override
    public R<DictSimpleResDto> getDictByDictTypeAndDictCode(String dictType, String dictCode) {
        DictSimpleResDto resDto = iSysDictService.getDictByDictTypeAndDictCode(dictType, dictCode);
        return R.ok(resDto);
    }

}
